Compiling Natural Semantics - ReadingSample

نویسنده

  • Mikael Pettersson
چکیده

Natural semantics has become a popular tool among programming language researchers. It is used for specifying many aspects of programming languages, including type systems, dynamic semantics, translations between representations, and static analyses. The formalism has so far largely been limited to theoretical applications, due to the absence of practical tools for its implementation. Those who try to use it in applications have had to translate their speci cations by hand into existing programming languages, which can be tedious and error-prone. Hence, natural semantics is rarely used in applications. Compiling high-level languages to correct and e cient code is non-trivial, hence implementing compilers is di cult and time-consuming. It has become customary to specify parts of compilers using special-purpose speci cation languages, and to compile these speci cations to executable code. While this has simpli ed the construction of compiler front-ends, and to some extent their back-ends, little is available to help construct those parts that deal with semantics and translations between higher-level and lower-level representations. This is especially true for the Natural Semantics formalism. In this thesis, we introduce the Relational Meta-Language, RML, which is intended as a practical language for natural semantics speci cations. Runtime e ciency is a prerequisite if natural semantics is to be generally accepted as a practical tool. Hence, the main parts of this thesis deal with the problem of compiling natural semantics, actually RML, to highly e cient code. We have designed and implemented a compiler, rml2c, that translates RML to e cient low-level C code. The compilation phases are described in detail. High-level transformations are applied to reduce the usually enormous amount of non-determinism present in speci cations. The resulting forms are often completely deterministic. Pattern-matching constructs are expanded using a pattern-match compiler, and a translation is made into a continuation-passing style intermediate representation. Intermediate-level CPS optimizations are applied before low-level C code is emitted. A new and e cient technique for mapping tailcalls to C has been developed. We have compared our code with other alternative implementations. Our

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Compiling Natural Semantics Into ML

This paper presents a compilation scheme from natural semantics speciications to ML. Permutations of premises allow, for a class of speciications, a purely functional execution and can reduce non-determinism. This method uses some speciic features of ML, like exceptions , closures and pattern-matching.

متن کامل

A Discourse Analysis of “The Prince and His Companions” in Kelileh and Demneh Based On Semio-Semantics

Despite showing an overtly simple structure, the semantic process in classic literary-narrative discourse conforms to complicated semiotic systems. As a result, semio-semantics is deemed as one of the most scientific, reliable tools since it helps intradiscursive semio-textual propositions be phenomenologically, and even epistemologically, analyzed. Consequently, the narrative discourse in “The...

متن کامل

Predicate-Induced Permutation Groups

Natural languages abound in combinatorial phenomena that are related to the predicate of the sentence and its ability to permute noun phrase arguments. After compiling several illustrative phenomena of natural languages, I propose a novel analysis in terms of permutation groups, a concept borrowed from mathematical combinatorics that is ubiquitous in applied sciences. I show that each natural l...

متن کامل

Compiling dynamic agent conversations1

We consider defining executable dialogues for communicating agents. Towards this end, we introduce agent classes whose communication primitives are based on deduction. Their operational semantics are given by an abstract logical machine that is defined purely in sequential terms. These agents communicate under the control of plans requiring a synchronization flag. These plans can be rewritten a...

متن کامل

Combining Deep and Shallow Embedding for EDSL

When compiling embedded languages it is natural to use an abstract syntax tree to represent programs. This is known as a deep embedding and it is a rather cumbersome technique compared to other forms of embedding, typically leading to more code and being harder to extend. In shallow embeddings, language constructs are mapped directly to their semantics which yields more flexible and succinct im...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2015